<?php 
$myconn=mysql_connect("localhost","root","");
mysql_select_db("dianexia",$myconn);
mysql_query("SET NAMES 'utf8'");
//设置网站路径,注意最后木有杠
define("SITE_ROOT","http://localhost:8080/dianexia");
//define("SITE_ROOT","http://192.168.1.100:8080/dianexia");
define("COOKE_TIME",time()+3600*24);
define("DOMAIN","dianxia.com");
session_start();
//根据url判断当前链接地址是否为选中状态..
function createActive($url){
	$arr=explode("/",$_SERVER["REQUEST_URI"]);
	if($url==$arr[count($arr)-1]){
		echo "class=\"active\"";
	}else{
		echo $url."==".$arr[count($arr)-1];
	}
}
function setBusenessCookie($bid){
	$sql="select * from zy_businessarea where id=".$bid;
	$result=mysql_query($sql);
	if($arr=mysql_fetch_array($result)){
	     setcookie('busenessarea_id', $arr['id'],COOKE_TIME);
	  	 setcookie('busenessarea_name', $arr['name'],COOKE_TIME);
	     setcookie('busenessarea_parentid', $arr['parentId'],COOKE_TIME);
	     setcookie('busenessarea_level', $arr['level'],COOKE_TIME);
		 header("location:index.php");
	}
}
$_busenessarea_id=$_COOKIE['busenessarea_id'];
if($_busenessarea_id>0){
	if(isset($_REQUEST['bid'])&&$_REQUEST['bid']!=$busenessarea_id){
		setBusenessCookie($_REQUEST['bid']);
	}
}else{
		if(isset($_REQUEST['bid'])){
			setBusenessCookie($_REQUEST['bid']);
		}else if(!isset($_COOKIE['busenessarea_id'])){
			$show_buseness=true;
		}
	}

require_once(dirname(__FILE__)."/../include/zy_function.php");
?>